import {createStore, combineReducers, applyMiddleware} from 'redux';
import {composeWithDevTools} from 'redux-devtools-extension';
import { websocketMiddleware, initMiddleware } from 'redux-ws-middleware';
import wsConfig from './ws.config';

import {
  settingsReducer,
  todosReducer,
  websocketEventsReducer
} from '../reducers';

const reducer = combineReducers({
  settings: settingsReducer,
  todos: todosReducer,
  ws: websocketEventsReducer
});

initMiddleware(wsConfig);

export default createStore(reducer, composeWithDevTools(
  applyMiddleware(websocketMiddleware)
));
